package com.lagou.ipersistence.transaction.jdbc;

import com.lagou.ipersistence.session.TransactionIsolationLevel;
import com.lagou.ipersistence.transaction.Transaction;
import com.lagou.ipersistence.transaction.TransactionFactory;

import javax.sql.DataSource;
import java.sql.Connection;
import java.util.Properties;

/**
 * @author Yan Jiahong
 * Created on 2020/11/22
 */
public class JdbcTransactionFactory implements TransactionFactory {
    
    @Override
    public void setProperties(Properties props) {
    
    }
    
    @Override
    public Transaction newTransaction(Connection connection) {
        return new JdbcTransaction(connection);
    }
    
    @Override
    public Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit) {
        return new JdbcTransaction(dataSource, level, autoCommit);
    }
}
